package com.tc.itfarm.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.tc.itfarm.dao.SingleTableMapper;
import com.tc.itfarm.service.BaseService;

public class BaseServiceImpl<T> implements BaseService<T> {

	protected SingleTableMapper<T,?> mapper;
	
	@Override
	public void insert(T t) {
		mapper.insert(t);
	}

	public void update(T t) {
		mapper.updateByPrimaryKey(t);
	}

	@Override
	public void delete(Integer id) {
		mapper.deleteByPrimaryKey(id);
	}

	@Override
	public T select(Integer id) {
		return (T) mapper.selectByPrimaryKey(id);
	}

	@Override
	public List<T> selectAll() {
		return null;
	}

	public SingleTableMapper<T, ?> getMapper() {
		return mapper;
	}

	public void setMapper(SingleTableMapper<T, ?> mapper) {
		this.mapper = mapper;
	}
	
}
